<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="./pages/styles/style2.css" />
<title>Candidates</title>
</head>

<body>
	<jsp:directive.include file="Header.jsp" />
	<jsp:directive.include file="Navigation.jsp" />
	<div class="content">
		<div class="content-header">
			<h1>
				Candidates <img src="./pages/images/logo.png" align="right"
					width="130" height="40">
			</h1>
		</div>
		<c:choose>
			<c:when test="${empty candidateList}">
				<div class="content-tag">
					<h3>No available candidates!</h3>
				</div>
			</c:when>
			<c:otherwise>
				<c:forEach var="candidate" items="${candidateList}">
					<form action="./ShowCandidates" method="post">
						<div class="content-tag">
							<div class="content-tag-header">
								<table>
									<tr>
										<td>
											<h2>${candidate.firstName}${candidate.lastName}</h2>
										</td>
										<td><input type="hidden" name="candidateId"
											value="${candidate.id}"> <c:if
												test="${role == 'general' or role == 'recruiter' }">
												<input class="button" type="submit" name="recommendToJob"
													value="Recommend">
												<input class="button" type="submit" name="update"
													value="Update">
												<input class="button" type="submit" name="delete"
													value="Delete">
											</c:if></td>
									</tr>
								</table>
							</div>
							<ul>
								<li><label>Phone number:</label> ${candidate.phoneNumber }</li>
								<li><label>Mobile number:</label> ${candidate.mobileNumber }</li>
								<li><label>E-Mail :</label> ${candidate.mail }</li>
								<li><label>Address :</label> ${candidate.address }</li>
								<li><label>Relocation :</label> ${candidate.relocation }</li>
								<li><label>Hired :</label> ${candidate.hired }</li>
								<li><label>CV :</label><input class="button" type="submit"
									name="download" value="Download"></li>
								<li>
									<h3>
										Interviews
										<c:if test="${role == 'general' or role == 'recruiter' }">
											<input class="button" type="submit" name="addInterview"
												value="Add Interview">
										</c:if>
									</h3> <c:choose>
										<c:when test="${empty candidate.interview }">
											<h4>No available interviews!</h4>
										</c:when>
										<c:otherwise>
											<c:forEach var="interview" items="${candidate.interview}">
												<div class="interview-tag">
													<ul>
														<li><label> With: ${interview.user.firstName}
																${interview.user.lastName} </label></li>
													</ul>
													<ul>
														<li><label> At: ${interview.date } </label></li>
													</ul>
													<ul>
														<li><label> Feedback :
																${interview.feedBack.content } </label></li>
													</ul>
												</div>
											</c:forEach>
										</c:otherwise>
									</c:choose>
								</li>
								<li>
									<h3>Comments</h3>

									<div class="comment-area">
										<table>
											<tr>
												<td><textarea type="text" name="commentArea"
														placeholder="Enter  your  comment!"></textarea></td>
											</tr>
											<tr>
												<td><input type="submit" name="addComment"
													class="button" value="Add Comment" /></td>
											</tr>
										</table>
									</div> <c:choose>
										<c:when test="${empty candidate.comments }">
											<div class="comment-tag">
												<h4>No available comments!</h4>
											</div>
										</c:when>
										<c:otherwise>
											<c:forEach var="comment" items="${candidate.comments}">
												<div class="comment-tag">
													<ul>
														<li><label> Date: ${comment.date } </label></li>
													</ul>
													<ul>
														<li><label> User: ${comment.user.firstName }
																${comment.user.lastName } </label></li>
													</ul>
													<ul>
														<li><label> Text : ${comment.content } </label></li>
													</ul>
												</div>
											</c:forEach>
										</c:otherwise>
									</c:choose>
								</li>
							</ul>
						</div>
					</form>
				</c:forEach>
			</c:otherwise>
		</c:choose>
	</div>
</body>
</html>